<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body onload="setcolor()">
<div id=mydiv style="font:12px sans-serif;width:30000px;height:20000px;">背景色测试</div>
<script>
  function setcolor() {
    var colorString;
    do{
      colorString="#"+Math.floor(Math.random()*Math.pow(2,24)).toString(16);
     }
    while (colorString.length<7);
      document.getElementById("mydiv").style.backgroundColor=colorString;
      setTimeout(setcolor,100);
  }
</script>
</body>
</html>